import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import WindiCSS from "vite-plugin-windicss";
import path from "path"; // 导入 path 模块

// https://vite.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
  },
  plugins: [vue(), WindiCSS()],
  server: {
    port: 5173, // 指定端口
    host: "0.0.0.0", // 指定使用一个 host，默认是 localhost
    proxy: {
      "/springbootsiiny4vh": {
        target: "http://localhost:8080/springbootsiiny4vh/", // 代理目标地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/springbootsiiny4vh/, ""), // 在发出请求后将/springbootsiiny4vh替换为空值
        secure: false, // 如果是https请求需要设置为true，这里因为是http所以设为false
      },
    },
  },
});
